import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'

const app = createApp(App)
const pinia = createPinia()

app.use(pinia)
app.use(router)

// 在挂载前初始化用户认证状态
const initializeApp = async () => {
  // 导入并初始化用户状态
  const { useUserStore } = await import('@/stores/user')
  const userStore = useUserStore()
  userStore.checkAuth()
  
  app.mount('#app')
}

initializeApp()